<template>
  <el-card class="box-card">
    <div
      class="title"
      style="color: #333333; font-size: 20px; font-weight: bold"
    >
      条件筛选
    </div>
    <el-form
      label-position="right"
      label-width="100px"
      size="mini"
      :inline="true"
      :model="ss"
      ref="refform"
      class="demo-form-inline wrap_inline"
      style="background: #fff"
    >
       <el-form-item label="台区名称:">
          <el-input
            v-model="ss.name"
            placeholder="请输入"
            clearable
            class="input_inner_header"
          ></el-input>
        </el-form-item>
       <el-form-item label="台区编码:">
          <el-input
            v-model="ss.name"
            placeholder="请输入"
            clearable
            class="input_inner_header"
          ></el-input>
        </el-form-item>
      <el-form-item label="所属区域">
        <el-select v-model="ss.serviceType" clearable class="input_inner">
          <el-option
            v-for="item in serviceTypes"
            :key="item.value"
            :label="item.name"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
         <el-button style="margin-left: 20px" type="primary" @click="cx"
          >导出历史负荷</el-button
        >
         <el-button type="primary" @click="cx"
          >查询</el-button
        >
        <el-button @click="reset" type="primary">重置</el-button>
      </el-form-item>
    </el-form>
  </el-card>
</template>
<style lang="scss" scoped>
.wrap_inline {
  background: #fff;
}
.box-card {
  margin: 20px;
}
.wrap_inline {
  padding: 14px 5px 0px 5px;
}
.wrap_inline .input_inner {
  width: 120px;
}
</style>
<script>
import { mapState, mapMutations } from "vuex";
export default {
  data() {
    return {
      value1: '',
      serviceTypes: [],
      orgTypes: [],
      regionId: [],
      ss: {
        name: null,
        type: null,
        serviceType: null,
        regionId: null,
        linkName: null,
        linkPhone: null,
      },
      defaultProps: {
        checkStrictly: true,
        children: "children",
        value: "id",
        label: "name",
      },
    };
  },
  created() {},
  computed: {
    ...mapState(["regTree"]),
  },
  methods: {
    setData() {
      this.serviceTypes = this.$parent.$parent.$parent.serviceTypes;
      this.orgTypes = this.$parent.$parent.$parent.orgTypes;
    },
    //省市区三联框点击后触发
    handleChange(value) {
      this.ss.regionId = value[value.length - 1]; //取地区里最后一个值发给后端
    },
    cx() {
      this.$parent.$parent.$parent.$refs.biaoge.cx(this.ss);
      this.$parent.$parent.$parent.$refs.biaoge.ids = null;
      this.$parent.$parent.$parent.$refs.tree.selOrg = null;
    },
    reset() {
      this.ss = {};
      this.regionId = [];
      this.$parent.$parent.$parent.$refs.biaoge.ids = null;
      this.$parent.$parent.$parent.$refs.tree.selOrg = null;
    },
    getTreeData(data) {
      for (var i = 0; i < data.length; i++) {
        if (data[i].children.length < 1) {
          data[i].children = undefined;
        } else {
          this.getTreeData(data[i].children);
        }
      }
      return data;
    },
  },
};
</script>
